package com.it.service.impl;

import com.it.dao.BookDao;
import com.it.service.BookService;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class BookServiceImpl implements BookService, InitializingBean, DisposableBean {

    private BookDao bookDao;

    public void save() {
        System.out.println("book service save ...");
        bookDao.save();
    }

    // 设置属性
    public void setBookDao(BookDao bookDao) {
        System.out.println("service set ...");
        this.bookDao = bookDao;
    }

    // 表示bean销毁前对应操作
    public void destroy() throws Exception {
        System.out.println("service destroy ...");
    }

    // 设置属性后执行(初始化)
    public void afterPropertiesSet() throws Exception {
        System.out.println("service init ...");
    }
}
